
 /**  
 * Project Name:zhonghecrm  
 * File Name:JsonUtil.java  
 * Package Name:com.crm.util  
 * Date:2016年10月14日下午5:02:43   
 *  
*/  
  
package com.crm.util;

import java.util.Random;
import java.util.UUID;

import org.apache.shiro.crypto.hash.Md5Hash;

 /**  
 * ClassName: UUIDUtil <br/>  
 * Function: TODO ADD FUNCTION. <br/>  
 * Reason: TODO ADD REASON(可选). <br/>  
 * date: 2016年10月18日 上午10:24:22 <br/>  
 *  
 * @author hanlinxiu  
 * @version   
 * @since JDK 1.8  
 */
public class UUIDUtil {
	
	private UUIDUtil(){}
	
	public static String getUUID(){
		
		return UUID.randomUUID().toString();
	}
	
	public static String getMD5(String str, String salt){
		
		return new Md5Hash(str, salt).toString();
	}
	
	public static String genRandomNum(){
		 int  maxNum = 36;  
	     int i;  
	     int count = 0;
	     char[] str = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',  
	    	        'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',  
	    	        'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' };
	     StringBuffer pwd = new StringBuffer("");
	     Random r = new Random();
	     while(count < 8){
	    	  i = Math.abs(r.nextInt(maxNum));
	    	  if (i >= 0 && i < str.length) {
	    		  pwd.append(str[i]); 
	    		  count ++; 
	    	  }
	     }
		return pwd.toString();
	}
	
}
  
